<?php
session_start();
require_once("./include/membersite_config.php");
require_once("./include/Mobile_Detect.php");
if($_SESSION['cur_href'] != $fgmembersite->GetSelfScript())
{
	$_SESSION['pre_href'] = $_SESSION['cur_href'];
	$_SESSION['cur_href'] = $fgmembersite->GetSelfScript();
}

$detect = new Mobile_Detect;
 
// Any mobile device (phones or tablets).
if ( $detect->isMobile() ) 
{
	$_SESSION['device'] = 'mobile' ;
	$_SESSION['main-div-left'] = 0;
	$_SESSION['main-div-center'] = 12;
	$_SESSION['main-div-right'] = 0;
}
// Any tablet device.
else if( $detect->isTablet() )
{
	$_SESSION['device'] = 'tablet' ;
	$_SESSION['main-div-left'] = 3;
	$_SESSION['main-div-center'] = 6;
	$_SESSION['main-div-right'] = 3;
}
// Exclude tablets.
else
{
	$_SESSION['device'] = 'pc' ;
	$_SESSION['main-div-left'] = 4;
	$_SESSION['main-div-center'] = 4;
	$_SESSION['main-div-right'] = 4;
}
?>
<?php
require_once("./include/membersite_config.php");
?>
<?PHP
if(isset($_POST['Submit']))
{
   if($fgmembersite->Quick_Login_Form_Handler())
   {
        $fgmembersite->RedirectToURL($_SESSION['pre_href']);
		$fgmembersite->RedirectToURL($fgmembersite->GetSelfScript());   
   }
   
}

?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><?PHP $fgmembersite->GetString('Log in','Đăng nhập')?></title>
<?PHP
require_once("./pre-config.php");
?>
</head> 
<body>
<?PHP
require_once("./main-nav.php");
?>
<div class="container">
    <div class="row">
<?PHP
    print '<div class="col-md-'.$_SESSION['main-div-left'].'">';
	print '</div>';
    print '<div class="col-md-'.$_SESSION['main-div-center'].'">';
?>
			<form id='login' action='<?php echo $fgmembersite->GetSelfScript(); ?>' method='post' accept-charset='UTF-8'>
				<div id="notice-board">
					<?PHP $fgmembersite->GetErrorMessage()?>				
				</div>
				<div class="form-group">
					<h4 class="text-primary"><?PHP $fgmembersite->GetString('Login:','Đăng nhập:')?></h4>
					<p class="text-right"><a href="sign-up.php"><?PHP $fgmembersite->GetString('Sign up','Đăng ký:')?></a></p>
					<label for="inputuser_name"><?PHP $fgmembersite->GetString('User name*','Tên đăng nhập*')?></label>
					<input type="text" class="form-control" name="user_name" id="user_name" value='<?php echo $fgmembersite->SafeDisplay('user_name'); ?>' maxlength="32"/>
					<label for="inputPassword"><?PHP $fgmembersite->GetString('Password*','Mật khẩu*')?></label>
					<input type="password" class="form-control" name="password" id="password" value='<?php echo $fgmembersite->SafeDisplay('password'); ?>' maxlength="32"/>
				</div>
				<button type="submit"  name='Submit' class="btn btn-success center-block"><?PHP $fgmembersite->GetString('Login','Đăng nhập')?></button>
			</form>
		</div>
<?PHP
    print '<div class="col-md-'.$_SESSION['main-div-right'].'">';
	print '</div>';
?>	
    </div>
</div>
<?PHP
require_once("./footer.php");
?></body>

</html>                                		